home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / etc / init.d / networking < prev    next >
Text File  |  2009-09-14  |  2KB  |  95 lines

  1. #!/bin/sh -e
  2. ### BEGIN INIT INFO
  3. # Provides:          networking
  4. # Required-Start:    
  5. # Required-Stop:     $local_fs
  6. # Default-Start:     
  7. # Default-Stop:      0 6
  8. # Short-Description: Raise network interfaces.
  9. ### END INIT INFO
  10.  
  11. PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
  12.  
  13. [ -x /sbin/ifup ] || exit 0
  14.  
  15. . /lib/lsb/init-functions
  16.  
  17. # helper function to set the usplash timeout. https://launchpad.net/bugs/21617
  18. usplash_timeout () {
  19.     TIMEOUT=$1
  20.     if [ -x /sbin/usplash_write ]; then
  21.         /sbin/usplash_write "TIMEOUT $TIMEOUT" || true
  22.     fi
  23. }
  24.  
  25. process_options() {
  26.     [ -e /etc/network/options ] || return 0
  27.     log_warning_msg "/etc/network/options still exists and it will be IGNORED! Read README.Debian of netbase."
  28. }
  29.  
  30. check_network_file_systems() {
  31.     [ -e /proc/mounts ] || return 0
  32.  
  33.     exec 9<&0 < /proc/mounts
  34.     while read DEV MTPT FSTYPE REST; do
  35.     case $DEV in
  36.     /dev/nbd*|/dev/nd[a-z]*|/dev/etherd/e*)
  37.         log_warning_msg "not deconfiguring network interfaces: network devices still mounted."
  38.         exit 0
  39.         ;;
  40.     esac
  41.     case $FSTYPE in
  42.     nfs|nfs4|smbfs|ncp|ncpfs|cifs|coda|ocfs2|gfs|pvfs|pvfs2|fuse.httpfs|fuse.curlftpfs)
  43.         log_warning_msg "not deconfiguring network interfaces: network file systems still mounted."
  44.         exit 0
  45.         ;;
  46.     esac
  47.     done
  48.     exec 0<&9 9<&-
  49. }
  50.  
  51. case "$1" in
  52. start)
  53.     /lib/init/upstart-job networking start
  54.     ;;
  55.  
  56. stop)
  57.     check_network_file_systems
  58.  
  59.     log_action_begin_msg "Deconfiguring network interfaces"
  60.     if [ "$VERBOSE" != no ]; then
  61.         if ifdown -a --exclude=lo; then
  62.         log_action_end_msg $?
  63.         else
  64.         log_action_end_msg $?
  65.         fi
  66.     else
  67.         if ifdown -a --exclude=lo >/dev/null 2>/dev/null; then
  68.         log_action_end_msg $?
  69.         else
  70.         log_action_end_msg $?
  71.         fi
  72.     fi
  73.     ;;
  74.  
  75. force-reload|restart)
  76.     process_options
  77.  
  78.     log_action_begin_msg "Reconfiguring network interfaces"
  79.     ifdown -a --exclude=lo || true
  80.     if ifup -a --exclude=lo; then
  81.         log_action_end_msg $?
  82.     else
  83.         log_action_end_msg $?
  84.     fi
  85.     ;;
  86.  
  87. *)
  88.     echo "Usage: /etc/init.d/networking {start|stop|restart|force-reload}"
  89.     exit 1
  90.     ;;
  91. esac
  92.  
  93. exit 0
  94.  
  95.